template.defaults.imports.date = function(value) {
	if (!value) return '';
	
	var d = new Date(value);
	
	var year = d.getFullYear();
	var month = d.getMonth() + 1;
	var date = d.getDate();
	
	if (month < 10) month = '0' + month;
	if (date < 10) date = '0' + date;
	
	return year + '-' + month + '-' + date;
}

template.defaults.imports.week = function(value) {
	console.log(value);
	if (!value) return "";
	var date = new Date(value);
	var w = date.getDay();
	
	return "星期" + ["日", "一", "二", "三", "四", "五", "六"][w];
}

template.defaults.imports.ipStr = function(value) {
	console.log(value);
	if (!value) return '';
	if (value.startsWith('0:')) return '127.0.0.1';
	return value
}

template.defaults.imports.random = function(value, list) {
	var arr = list.split(',');
	return arr[Math.floor(Math.random() * arr.length)];
}